#!/bin/bash

image_name=nginx-volume
container_name=nginx-volume

docker build -t $image_name:$1 .
docker stop $container_name
docker rm $container_name
docker run -d --name $container_name -v /etc/nginx -v /usr/share/nginx/html $image_name:$1
echo "$container_name is ok"

server_image_name=nginx-php-fpm:0.1
server_container_name=php

docker stop $server_container_name
docker rm $server_container_name
docker run -d --name $server_container_name --volumes-from $container_name --link mysql-server:mysql -p 80:80 $server_image_name
echo "$server_container_name is ok"